package com.imagination.applet.domain.utils;

import com.google.common.io.Files;
import com.imagination.applet.infrastructure.utils.DateTimeUtils;

import java.io.File;
import java.util.UUID;

public class ImagePathGenerator {

    public static String next(String fileName){
        String suffix = Files.getFileExtension(fileName);
        return nextPathWithSuffix(suffix);
    }

    public static String nextPathWithSuffix(String fileSuffix) {
        String name = UUID.randomUUID().toString().replace("-", "") + "." + fileSuffix;
        return DateTimeUtils.nowToPath() + "/" + name;
    }

    public static String next2(String fileName){
        String suffix = Files.getFileExtension(fileName);
        return nextPathWithSuffix2(suffix);
    }

    public static String nextPathWithSuffix2(String fileSuffix) {
        return UUID.randomUUID().toString().replace("-", "") + "." + fileSuffix;
    }
}
